export {
  fn
}
const list = [
  {
    name: 'a1',
    id: 'a1'
  },
  {
    name: 'a2',
    id: 'a2'
  },
  {
    name: 'a3',
    id: 'a3'
  },
  {
    name: 'b1',
    id: 'b1'
  },
  {
    name: 'b2',
    id: 'b2'
  },
  {
    name: 'c1',
    id: 'c1'
  },
  {
    name: 'c2',
    id: 'c2'
  },
]
function fn(params) {
  let {val:val} = JSON.parse(params.body)
  let newList = []
  newList = val ? list.filter((item)=> item.name.includes(val)) :list
  return {
    code: 200,
    list: newList,
    total: newList.length
  }
}